package com.atguigu.flink.wordcount;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 *
 *
 *      需要多少个Slot:
 *              考虑是否可以进行OperatorChain
 *              取所有算子中并行度最大的作为Slot的数量。
 *
 *
 *
 *
 */
public class Demo13_SlotNum
{
    public static void main(String[] args) throws Exception {


        Configuration conf = new Configuration();
        conf.setInteger("rest.port",3333);
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(conf);


       env.socketTextStream("hadoop103",8888)
          .map(line -> line).setParallelism(3)
          .map(line -> line).setParallelism(3)
          .keyBy(line -> line)
          .print().setParallelism(3);


        env.execute();

    }
}
